package com.Service;

import com.dao.TeacherMapper;
import com.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherService {
    @Autowired
    private TeacherMapper teacherMapper;

    /**
     * 查询
     * @param teacher
     * @return
     */
    public List<Teacher> queryTeacher(Teacher teacher){
        return teacherMapper.selectAll();
    }

    /**
     * 新增
     * @param teacher
     * @return
     */
    public int addTeacher(Teacher teacher){
        return teacherMapper.insert(teacher);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    public int delTeacher(int id){
        return teacherMapper.deleteByPrimaryKey(id);
    }

    /**
     * 修改
     * @param teacher
     * @return
     */
    public int updateTeacher(Teacher teacher){
        return teacherMapper.updateByPrimaryKey(teacher);
    }
}
